package com.yufuchang;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by yufuchang on 2020/9/5.
 */
@RestController
public class NetController {

    @Autowired
    RestTemplate restTemplate;

    @GetMapping("/get_request")
    public void getDataFromNet(){
        String url = "http://v.juhe.cn/weather/forecast3h";
        String str = restTemplate.getForObject(url, String.class);
        System.out.println(str);
        return;
    }
}
